* {
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    outline: none;
    transition: border 0.3s;
}

.search-bar input:focus {
    border-color: #4CAF50;
}

.search-bar button {
    padding: 12px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #45a049;
}

.add-btn {
    display: block;
    margin: 0 auto 30px;
    padding: 12px 24px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.add-btn:hover {
    background-color: #0b7dda;
}

.bookmarks-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.bookmark-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.bookmark-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.bookmark-image {
    height: 180px;
    background-color: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.bookmark-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.bookmark-card:hover .bookmark-image img {
    transform: scale(1.05);
}

.bookmark-image .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #777;
    font-size: 14px;
    background-color: #e0e0e0;
}

.bookmark-info {
    padding: 20px;
}

.bookmark-title {
    font-size: 18px;
    margin: 0 0 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-url {
    color: #666;
    font-size: 14px;
    margin: 0 0 18px;
    word-break: break-all;
    line-height: 1.4;
}

.bookmark-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.visit-btn {
    padding: 10px 18px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.visit-btn:hover {
    background-color: #3e8e41;
}

.edit-btn, .delete-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.edit-btn {
    background-color: #FFC107;
    color: #333;
    margin-right: 10px;
}

.edit-btn:hover {
    background-color: #e0a800;
}

.delete-btn {
    background-color: #F44336;
    color: white;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal h2 {
    margin-top: 0;
    color: #333;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border 0.3s;
}

.form-group input:focus {
    border-color: #4CAF50;
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.save-btn, .cancel-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.save-btn {
    background-color: #4CAF50;
    color: white;
}

.save-btn:hover {
    background-color: #3e8e41;
}

.cancel-btn {
    background-color: #ddd;
    color: #333;
}

.cancel-btn:hover {
    background-color: #ccc;
}

.loading {
    display: flex;
    justify-content: center;
    padding: 20px;
    font-size: 18px;
    color: #666;
}

.error-message {
    color: #f44336;
    text-align: center;
    padding: 20px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .bookmarks-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}